
 package com.ami.vmedia.gui;
 
 import com.ami.iusb.IUSBRedirSession;
 import com.ami.kvm.jviewer.Debug;
 import com.ami.kvm.jviewer.JViewer;
 import com.ami.kvm.jviewer.gui.JViewerApp;
 import com.ami.kvm.jviewer.gui.LocaleStrings;
 import com.ami.kvm.jviewer.gui.customizefilechooser;
 import com.ami.vmedia.RedirectionController;
 import com.ami.vmedia.VMApp;
 import java.awt.Component;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.File;
 import javax.swing.JFileChooser;
 import javax.swing.JOptionPane;
 import javax.swing.JTextField;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 public class VMActionListener
   implements ActionListener
 {
   public static final String CD_IMAGE_PATH_ACTION_CMD = "CD_IMAGE_PATH_ADDRESS_";
   public static final String FD_IMAGE_PATH_ACTION_CMD = "FD_IMAGE_PATH_ADDRESS_";
   public static final String HD_IMAGE_PATH_ACTION_CMD = "HD_IMAGE_PATH_ADDRESS_";
   public static final String CD_CONNECT_ACTION_CMD = "CONNECT_CD_";
   public static final String FD_CONNECT_ACTION_CMD = "CONNECT_FD_";
   public static final String HD_CONNECT_ACTION_CMD = "CONNECT_HD_";
   public static final String CD_BROWSE_ACTION_CMD = "BROWSE_CD_";
   public static final String FD_BROWSE_ACTION_CMD = "BROWSE_FD_";
   public static final String HD_BROWSE_ACTION_CMD = "BROWSE_HD_";
   public static final String HD_FOLDER_BROWSE_ACTION_CMD = "FOLDER_BROWSE_HD_";
   public static final String HD_TEMP_IMAGE_BROWSE_ACTION_CMD = "TEMP_IMAGE_BROWSE_HD_";
   private JFileChooser fc;
   public String StoreLocation = null;
   
 
   public void actionPerformed(ActionEvent paramActionEvent)
   {
     String str = paramActionEvent.getActionCommand();
     int i; Object localObject1; Object localObject2; if (str.startsWith("BROWSE_CD_")) {
       i = getDeviceIndex(str);
       localObject1 = VMApp.getVMPane().getDeviceControlPanel(0, i).getDevicePanel();
       
       if (((DevicePanel)localObject1).getSelectedImagePath() == null)
         ((DevicePanel)localObject1).setSelectedImagePath(VMApp.cdImagePath[i][0]);
       localObject2 = VMApp.getInstance().getIUSBRedirSession().cdImageSelector(((DevicePanel)localObject1).getSelectedImagePath());
       
       if (localObject2 != null) {
         ((DevicePanel)localObject1).setImagePath((String)localObject2, 0, i);
         ((DevicePanel)localObject1).setSelectedImagePath((String)localObject2);
       }
     }
     else if (str.startsWith("BROWSE_FD_")) {
       i = getDeviceIndex(str);
       localObject1 = VMApp.getVMPane().getDeviceControlPanel(1, i).getDevicePanel();
       
       if (((DevicePanel)localObject1).getSelectedImagePath() == null)
         ((DevicePanel)localObject1).setSelectedImagePath(VMApp.fdImagePath[i][0]);
       localObject2 = VMApp.getInstance().getIUSBRedirSession().floppyImageSelector(((DevicePanel)localObject1).getSelectedImagePath());
       
       if (localObject2 != null) {
         ((DevicePanel)localObject1).setImagePath((String)localObject2, 1, i);
         ((DevicePanel)localObject1).setSelectedImagePath((String)localObject2);
       }
     }
     else if (str.startsWith("BROWSE_HD_")) {
       i = getDeviceIndex(str);
       localObject1 = VMApp.getVMPane().getDeviceControlPanel(2, i).getDevicePanel();
       
       if (((DevicePanel)localObject1).getSelectedImagePath() == null)
         ((DevicePanel)localObject1).setSelectedImagePath(VMApp.hdImagePath[i][0]);
       localObject2 = VMApp.getInstance().getIUSBRedirSession().floppyImageSelector(((DevicePanel)localObject1).getSelectedImagePath());
       
       if (localObject2 != null) {
         ((DevicePanel)localObject1).setImagePath((String)localObject2, 2, i);
         ((DevicePanel)localObject1).setSelectedImagePath((String)localObject2);
       }
     }
     else if (str.startsWith("CONNECT_CD_")) {
       i = getDeviceIndex(str);
       if (!JViewer.isCdServiceEnabled())
       {
         localObject1 = null;
         if (JViewer.isVMApp()) {
           VMApp.getInstance();
           localObject1 = VMApp.getVMFrame();
         }
         localObject1 = JViewerApp.getInstance().getVMDialog();
         
         Debug.out.println("cdrom service disabled");
         JOptionPane.showMessageDialog((Component)localObject1, LocaleStrings.getString("G_27_VMD"), LocaleStrings.getString("G_26_VMD"), 0);
         return;
       }
       VMApp.getInstance().getRedirectionController().handleDeviceRedirection(0, i);
     }
     else if (str.startsWith("CONNECT_FD_")) {
       i = getDeviceIndex(str);
       if (!JViewer.isFdServiceEnabled())
       {
         localObject1 = null;
         if (JViewer.isVMApp()) {
           VMApp.getInstance();
           localObject1 = VMApp.getVMFrame();
         }
         else {
           localObject1 = JViewerApp.getInstance().getVMDialog();
         }
         Debug.out.println("floppy service disabled");
         JOptionPane.showMessageDialog((Component)localObject1, LocaleStrings.getString("G_29_VMD"), LocaleStrings.getString("G_28_VMD"), 0);
         return;
       }
       VMApp.getInstance().getRedirectionController().handleDeviceRedirection(1, i);
     }
     else if (str.startsWith("CONNECT_HD_")) {
       i = getDeviceIndex(str);
       if (!JViewer.isHdServiceEnabled())
       {
         localObject1 = null;
         if (JViewer.isVMApp()) {
           VMApp.getInstance();
           localObject1 = VMApp.getVMFrame();
         }
         else {
           localObject1 = JViewerApp.getInstance().getVMDialog();
         }
         Debug.out.println("harddisk service disabled");
         JOptionPane.showMessageDialog((Component)localObject1, LocaleStrings.getString("G_31_VMD"), LocaleStrings.getString("G_30_VMD"), 0);
         return;
       }
       VMApp.getInstance().getRedirectionController().handleDeviceRedirection(2, i); } else { Object localObject3;
       int j;
       if (str.startsWith("FOLDER_BROWSE_HD_")) {
         i = getDeviceIndex(str);
         localObject1 = VMApp.getVMPane().getDeviceControlPanel(2, i).getDevicePanel();
         
         this.fc = new JFileChooser(this.StoreLocation);
         this.fc.setFileSelectionMode(1);
         localObject2 = new customizefilechooser();
         ((customizefilechooser)localObject2).customizeFileChooser(this.fc);
         
         localObject3 = null;
         
         if (JViewer.isVMApp()) {
           VMApp.getInstance();
           localObject3 = VMApp.getVMFrame();
         }
         else {
           localObject3 = JViewerApp.getInstance().getVMDialog();
         }
         
         j = this.fc.showDialog((Component)localObject3, LocaleStrings.getString("V_8_VRS"));
         if (j == 0) {
           if (this.fc.getSelectedFile().exists()) {
             this.StoreLocation = this.fc.getSelectedFile().toString();
           } else
             this.StoreLocation = this.fc.getSelectedFile().getParent();
         }
         ((DevicePanel)localObject1).folderTxt.setText(this.StoreLocation);
       }
       else if (str.startsWith("TEMP_IMAGE_BROWSE_HD_")) {
         i = getDeviceIndex(str);
         localObject1 = VMApp.getVMPane().getDeviceControlPanel(2, i).getDevicePanel();
         
         this.fc = new JFileChooser(this.StoreLocation);
         this.fc.setFileSelectionMode(1);
         localObject2 = new customizefilechooser();
         ((customizefilechooser)localObject2).customizeFileChooser(this.fc);
         
         localObject3 = null;
         if (JViewer.isVMApp()) {
           VMApp.getInstance();
           localObject3 = VMApp.getVMFrame();
         }
         else {
           localObject3 = JViewerApp.getInstance().getVMDialog();
         }
         j = this.fc.showDialog((Component)localObject3, LocaleStrings.getString("V_8_VRS"));
         if (j == 0) {
           if (this.fc.getSelectedFile().exists()) {
             this.StoreLocation = this.fc.getSelectedFile().toString();
           } else {
             this.StoreLocation = this.fc.getSelectedFile().getParent();
           }
         }
       }
     }
   }
   
 
 
 
 
   private int getDeviceIndex(String paramString)
   {
     int i = 0;
     String str = paramString.substring(paramString.lastIndexOf('_') + 1, paramString.length());
     i = Integer.parseInt(str);
     return i;
   }
 }


/* Location:              D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\vmedia\gui\VMActionListener.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       0.7.1
 */